package com.ele.Utils;

import com.alibaba.druid.pool.DruidDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class JDBCUtils {
    private static DruidDataSource ds;
    static {
        ds =new DruidDataSource();
        ds.setDriverClassName("com.mysql.cj.jdbc.Driver");
        ds.setUsername("root");
        ds.setPassword("root");
        ds.setUrl("jdbc:mysql://127.0.0.1:3306/javaweb_ele");

    }
    //
    public static DataSource getDs(){
        return ds;
    }

    public static Connection getConn() throws SQLException {
        return ds.getConnection();
    }


}
